// 将下面的异步代码使用Promise的方式改进
setTimeout(function() {
    var a = "hello"
    setTimeout(function() {
        var b = " lagou"
        setTimeout(function() {
            var c = ' I ❤ U'
            console.log(a + b + c);
        }, 10)
    }, 10)
}, 10)


//作业
function commonFn(val) {
    let promise = new Promise((resolved, rejected) => {
        setTimeout(() => {
            resolved(val + '')
        }, 10);
    })
    return promise;
}
commonFn()
    .then(() => {
        return commonFn('Hello')
    })
    .then((val) => {
        return commonFn(val + ' lagou')
    })
    .then((val) => {
        return commonFn(val + ' I ❤ U')
    })
    .then((val) => {
        console.log(val + '.');
    })